package com.changeover.gwt.client.view.impl;

import com.changeover.gwt.client.view.ITaskView;
import com.changeover.gwt.client.view.task.impl.CustomerGridView;
import com.changeover.gwt.shared.datasource.impl.ComplexCustomerDataSource;
import com.changeover.gwt.shared.datasource.impl.StandardCustomerDataSource;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class TaskView extends Composite implements ITaskView {

    private CustomerGridView complexCustomerGridView;
    private CustomerGridView standardCustomerGridView;
    
    public CustomerGridView getComplexCustomerGridView() {
        return complexCustomerGridView;
    }
    
    public CustomerGridView getStandardCustomerGridView() {
        return standardCustomerGridView;
    }
    
    public TaskView() {
        VerticalPanel mainPanel = new VerticalPanel();
        mainPanel.setStyleName("tab-content");
        
        // complex panel
        VerticalPanel complexPanel = new VerticalPanel();
        complexPanel.setStyleName("table-panel");
        mainPanel.add(complexPanel);

        // complex label
        Label complexPanelTitle = new Label("Complex Group and Authorization");
        complexPanelTitle.setStyleName("table-title");
        complexPanel.add(complexPanelTitle);
        complexPanel.setCellHeight(complexPanelTitle, "30px");
        
        // complex grid
        complexCustomerGridView = new CustomerGridView(new ComplexCustomerDataSource());
        //complexPanel.setCellHeight(complexCustomerGridView, "350px");
        complexPanel.add(complexCustomerGridView);
        complexCustomerGridView.setStyleName("table-body");
        //complexCustomerGridView.setSize("100%", "100%");

        // standard panel
        VerticalPanel standardsPanel = new VerticalPanel();
        standardsPanel.setStyleName("table-panel");
        mainPanel.add(standardsPanel);

        // standard label
        Label standardPanelTitle = new Label("Standard Customers");
        standardPanelTitle.setStyleName("table-title");
        standardsPanel.add(standardPanelTitle);
        standardsPanel.setCellHeight(standardPanelTitle, "30px");
        
        // standard grid
        standardCustomerGridView = new CustomerGridView(new StandardCustomerDataSource());
        //standardsPanel.setCellHeight(standardCustomerGridView, "350px");
        standardsPanel.add(standardCustomerGridView);
        standardCustomerGridView.setStyleName("table-body");
        //standardCustomerGridView.setSize("100%", "100%");

        initWidget(mainPanel);
    }

}
